<?php
class WEIXIN_APIAccessToken extends WPJAM_Model {
	private static $handler;

	public static function get_handler(){
		if(is_null(static::$handler)){
			static::$handler = new WPJAM_Option('weixin_'.weixin_get_appid().'_api_access_tokens', 'token');
		}
		return static::$handler;
	}

	public static function item_callback($item){
		$today	= date('Y-m-d', current_time('timestamp'));
		if($item['date']){
			if($item['date'] < $today ){
				$item['date'] = '<span style="color:red;">已经过期<br />'.$item['date'].'</span>';
			}else{
				$item['date'] = '<span style="color:green;">未过期<br />'.$item['date'].'</span>';
			}
		}else{
			$item['date'] = '<span style="color:green;">永久</span>';
		}

		return $item;
	}
}
